package com.liusaidh.controller;

import com.liusaidh.domain.AuditBlog;
import com.liusaidh.domain.Blog;
import com.liusaidh.domain.User;
import com.liusaidh.domain.UserReviews;
import com.liusaidh.result.Result;
import com.liusaidh.service.BlogService;
import com.liusaidh.service.FansService;
import com.liusaidh.service.UserService;
import com.liusaidh.utils.FileUtil;
import com.liusaidh.utils.MysqlConstants;
import io.swagger.annotations.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author 刘志文
 */
@Api(tags = "博文Controller")
@Controller
@RequestMapping("/blog")
public class BlogController {

    @Resource
    private BlogService blogService;
    @Resource
    private FansService fansService;
    @Resource
    private UserService userService;

    @PostMapping("/getLabelByLike")
    @ApiOperation(value = "查询标签", notes = "模糊查询标签,返回list集合，里面有所有的标签")
    @ResponseBody
    public List<String> getLabelByLike(@ApiParam(name = "condition") @RequestParam(name = "condition", required = false) String condition) {
        return blogService.getLabelByLike(condition);
    }

    @PostMapping("/getTypeByLike")
    @ApiOperation(value = "查询类别", notes = "模糊查询类别,返回list集合，里面有所有的类别")
    @ResponseBody
    public List<String> getTypeByLike(@ApiParam(name = "condition") @RequestParam(name = "condition", required = false) String condition) {
        return blogService.getTypeByLike(condition);
    }

    @PostMapping(value = "/addBlog", headers = "content-type=multipart/form-data")
    @ApiOperation(value = "发布博文", notes = "用户发布博文的操作,可以存到草稿箱")
    @ResponseBody
    public String addBlog(@ApiParam(name = "text", value = "文章的内容") @RequestParam(name = "text", required = false) String text,
                          @ApiParam(name = "type", value = "文章的类型") @RequestParam(name = "type", required = false) String[] type,
                          @ApiParam(name = "label", value = "文章的标签") @RequestParam(name = "label", required = false) String label,
                          @ApiParam(name = "state", value = "文章的状态，是发布还是存到草稿箱,0代表未审核  1代表经过审核  2代表在用户的草稿箱）") @RequestParam(name = "state", defaultValue = "0") Integer state,
                          @ApiParam(name = "myFiles", value = "发送的文件(一个或多个)") @RequestPart(name = "myFiles", required = false) MultipartFile[] myFiles,HttpSession session) throws Exception {
        String s = Arrays.toString(type);
        Blog blog = new Blog((Integer) session.getAttribute("id"), text, label, Arrays.toString(type), FileUtil.upload(myFiles), null);
        if (state.equals(MysqlConstants.BLOG_IN_DRAFT.getState())) {
            blogService.addBlogToDraftBox(blog);
            return "文章已经加入到草稿箱";
        } else {
            blogService.addBlog(blog, type);
            return "发布成功";
        }
    }

    @PostMapping("/likeBlog")
    @ApiOperation(value = "点赞博文", notes = "用户点赞博文的操作")
    @ResponseBody
    public Result likeBlog(@ApiParam(name = "bid", value = "博文的id值") @RequestParam(name = "bid") Integer bid,
                           HttpSession session) {
        Integer uid = (Integer) session.getAttribute("id");
        return blogService.likeBlog(uid, bid);
    }

    @PostMapping("/notLikeBlog")
    @ApiOperation(value = "取消点赞博文", notes = "用户取消点赞的操作")
    @ResponseBody
    public String notLikeBlog(@ApiParam(name = "bid", value = "博文的id值") @RequestParam(name = "bid") Integer bid,
                              HttpSession session) {
        blogService.notLikeBlog((Integer) session.getAttribute("id"), bid);
        return "取消点赞成功";
    }

    @GetMapping("/getIndexBlog")
    @ApiOperation(value = "获得热搜和主页的文章", notes = "获得热搜和主页的文章")
    @ApiResponses(@ApiResponse(code = 200, message = "查询成功，" +
            "1.hotBlogList属性中存放的是热搜数据，每一条为一个字符串 2.blogList中放的是全部的文章的数据，每一条为AuditBlog对象", response = AuditBlog.class))
    public ModelAndView getIndexBlog(@ApiParam(name = "state", value = "是否登陆,值为1代表到未登录的首页，为2代表登录的hot页面") @RequestParam("state") Integer state,
                                     @ApiParam(name = "pageNo", value = "当前的页码数") @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                     @ApiParam(name = "pageSize", value = "每页的数量") @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        ModelAndView mav = new ModelAndView();
        List<AuditBlog> blogList = blogService.getAllBlog(pageNo, pageSize);
        List<String> hotBlogList = blogService.getTenHotSearchBlog();
        if (state == 1) {
            mav.setViewName("unlogin");
        } else {
            mav.setViewName("hot");
        }
        mav.addObject("allType", blogService.getTypeByLike(null));
        mav.addObject("blogList", blogList);
        mav.addObject("hotLabelList", hotBlogList);
        return mav;
    }

    @GetMapping("/getTheLoadedBlog")
    @ApiOperation(value = "ajax获取将要加载的文章", notes = "获取将要加载的文章，前端传来页码数和数量，默认每页是10条", response = AuditBlog.class)
    @ResponseBody
    public List<AuditBlog> getIndexBlog(
            @ApiParam(name = "pageNo", value = "当前的页码数", required = true) @RequestParam(name = "pageNo") Integer pageNo,
            @ApiParam(name = "pageSize", value = "每页的数量") @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        return blogService.getTheLoadedBlog(pageNo, pageSize);
    }


    @GetMapping("/getHotSearchBlog")
    @ApiOperation(value = "获取热搜文章，用于显示标签", notes = "根据点赞量和转发量判断热搜")
    @ApiResponses(@ApiResponse(code = 200, message = "查询成功，list属性中存放的是热搜数据，每一条为一个对象", response = String.class))
    @ResponseBody
    public List<String> getHotSearchBlog() {
        return blogService.getTenHotSearchBlog();
    }

    @GetMapping("/getHotBlog")
    @ApiOperation(value = "获取热搜文章前50条给已经登录的用户", notes = "根据点赞量和转发量判断热搜")
    @ApiResponses(@ApiResponse(code = 200, message = "查询成功，list属性中存放的是热搜数据，每一条为一个对象", response = Blog.class))
    public ModelAndView getHotBlog() {
        ModelAndView mav = new ModelAndView("hot-search");
        List<String> list = blogService.getHotBlog();
        mav.addObject("allType", blogService.getTypeByLike(null));
        mav.addObject("hotLabelList", list);
        return mav;
    }


    @GetMapping("/collectOtherBlog")
    @ApiOperation(value = "收藏其他的文章", notes = "用户收藏文章，并记录信息")
    @ResponseBody
    public String collectOtherBlog(@ApiParam(name = "id", value = "文章的id") @RequestParam(name = "id", required = false) Integer id,
                                   @ApiParam(name = "msg", value = "用户收藏时记录的信息") @RequestParam(name = "msg", required = false) String msg,
                                   HttpSession session) {
        blogService.collectOtherBlog((Integer) session.getAttribute("id"), id, msg);
        return "收藏成功";
    }

    @GetMapping("/notCollectOtherBlog")
    @ApiOperation(value = "取消收藏其他的文章", notes = "用户取消收藏文章")
    @ResponseBody
    public String notCollectOtherBlog(@ApiParam(name = "id", value = "文章的id") @RequestParam(name = "id", required = false) Integer id,
                                      HttpSession session) {
        blogService.notCollectOtherBlog((Integer) session.getAttribute("id"), id);
        return "取消收藏成功";
    }


    @PostMapping("/publishFirstComment")
    @ApiOperation(value = "发表一级评论", notes = "哪一个用户再哪一个文章下发布评论")
    @ResponseBody
    public Result publishFirstComment(@ApiParam(name = "id", value = "文章的id值", required = true) @RequestParam(name = "id") Integer id,
                                      HttpSession session,
                                      @ApiParam(name = "comment", value = "评论的内容", required = true) @RequestParam(name = "comment") String comment) {

       return blogService.publishFirstComment((Integer) session.getAttribute("id"), id, comment) ;
    }


    @PostMapping("/publishSecondComment")
    @ApiOperation(value = "发表二级评论", notes = "哪一个用户再哪一个一级评论下发布二级评论")
    @ResponseBody
    public String publishSecondComment(@ApiParam(name = "id", value = "一级评论的id值", required = true) @RequestParam(name = "id") Integer id,
                                       HttpSession session,
                                       @ApiParam(name = "comment", value = "二级评论的内容", required = true) @RequestParam(name = "comment") String comment) {
        if (blogService.publishSecondComment((Integer) session.getAttribute("id"), id, comment) == 1) {
            return "发布成功";
        } else {
            return "发布失败";
        }
    }


    @GetMapping("/getBlogComment")
    @ApiOperation(value = "查询全部评论", notes = "查询某个文章的评论,数据放在名为List集合中，每一条为一个UserReviews对象，二级评论在UserReviews的list属性中")
    @ResponseBody
    public List<UserReviews> getBlogComment(@ApiParam(name = "id", value = "文章的id值", required = true) @RequestParam(name = "id") Integer id, HttpSession session) {
        return blogService.getBlogComment(id);
    }

    //获得我的关注的文章
    @GetMapping("/getMyConnectionBlog")
    @ApiOperation(value = "获得我关注的文章", notes = "获得我关注的文章，按时间排序, list中放的是全部的文章的数据，每一条为AuditBlog对象；")
    public ModelAndView getMyConnectionBlog(HttpSession session) {
        ModelAndView mav = new ModelAndView("home");
        List<AuditBlog> list = blogService.getMyConnectionBlog((Integer) session.getAttribute("id"), 1, 10);//我关注的文章
        List<AuditBlog> allBlog = blogService.getAllBlog(1, 10);//全部的文章
        mav.addObject("allBlog", allBlog);
        mav.addObject("list", list);
        return mav;
    }

    //获得我的关注的文章
    @GetMapping("/getLoadedMyConnectionBlog")
    @ApiOperation(value = "ajax获得我关注的文章，用于全部关注", notes = "全部的文章的数据，每一条为AuditBlog对象", response = AuditBlog.class)
    @ResponseBody
    public List<AuditBlog> getLoadedMyConnectionBlog(HttpSession session,
                                                     @ApiParam(name = "pageNo", value = "当前的页码数") @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                     @ApiParam(name = "pageSize", value = "每页的数量") @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        return blogService.getMyConnectionBlog((Integer) session.getAttribute("id"), pageNo, pageSize);
    }

    @GetMapping("/getMyLatestConnectionBlog")
    @ApiOperation(value = "获得我最近关注的文章", notes = "获得我关注的文章，按时间排序")
    @ApiResponses(@ApiResponse(code = 200, message = "查询成功，" +
            "list中放的是全部的文章的数据，每一条为AuditBlog对象；同时返回一个idolsList集合里面放的是该用户关注的人的所有的id值，", response = AuditBlog.class))
    public ModelAndView getMyLatestConnectionBlog(HttpSession session) {
        ModelAndView mav = new ModelAndView("home-new");
        List<AuditBlog> list = blogService.getMyLatestConnectionBlog((Integer) session.getAttribute("id"), 1, 10);
        List<String> hotLabelList = blogService.getTenHotSearchBlog();//右边10个热搜
        mav.addObject("allType", blogService.getTypeByLike(null));
        mav.addObject("hotLabelList", hotLabelList);
        mav.addObject("list", list);
        return mav;
    }

    @GetMapping("/getLoadedMyLatestConnectionBlog")
    @ApiOperation(value = "ajax获得我最近关注的文章，用于最新微博", notes = "获得我关注的文章，按时间排序")
    @ApiResponses(@ApiResponse(code = 200, message = "全部的文章的数据，每一条为AuditBlog对象；", response = AuditBlog.class))
    @ResponseBody
    public List<AuditBlog> getLoadedMyLatestConnectionBlog(HttpSession session,
                                                           @ApiParam(name = "pageNo", value = "当前的页码数") @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                           @ApiParam(name = "pageSize", value = "每页的数量") @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        return blogService.getMyLatestConnectionBlog((Integer) session.getAttribute("id"), pageNo, pageSize);

    }

    @PostMapping(value = "/deleteComment")
    @ApiOperation(value = "删除评论", notes = "用户删除评论")
    @ResponseBody
    public String deleteComment(@ApiParam(name = "id", value = "评论的id") @RequestParam(name = "id") Integer id) {
        return blogService.deleteComment(id) >= 1 ? "删除成功" : "删除失败";
    }


    @PostMapping(value = "/forwardTheBlog")
    @ApiOperation(value = "转发文章", notes = "用户转发了哪个文章")
    @ResponseBody
    public String forwardTheBlog(HttpSession session,
                                 @ApiParam(name = "bid", value = "文章的id") @RequestParam(name = "bid") Integer bid,
                                 @ApiParam(name = "message", value = "message") @RequestParam(name = "bid", required = false, defaultValue = "转发文章") String message) {
        return blogService.forwardTheBlog((Integer) session.getAttribute("id"), bid, message) == 1 ? "转发成功" : "转发失败";
    }

    @ApiOperation(value = "该接口用来判断该用户是否点赞其他的文章", notes = "用来判断该用户是否点赞其他的文章，传来文章的id,返回true代表点赞，false代表未点赞", response = boolean.class)
    @PostMapping("/judgeBlogOfLike")
    @ResponseBody
    public boolean judgeBlogOfLike(@ApiParam(value = "文章的id值", required = true) @RequestParam("id") Integer id,
                                   @ApiParam(value = "用于存放登录的用户的id") HttpSession session) {
        return blogService.judgeBlogOfLike((Integer) session.getAttribute("id"), id);
    }

    @ApiOperation(value = "该接口用来判断该用户是否收藏其他的文章", notes = "用来判断该用户是否收藏其他的文章，传来文章的id,返回true代表收藏，false代表未收藏", response = boolean.class)
    @PostMapping("/judgeBlogOfConnection")
    @ResponseBody
    public boolean judgeBlogOfCollection(@ApiParam(value = "文章的id值", required = true) @RequestParam("id") Integer id,
                                         @ApiParam(value = "用于存放登录的用户的id") HttpSession session) {
        return blogService.judgeBlogOfCollection((Integer) session.getAttribute("id"), id);
    }

    @ApiOperation(value = "该接口用来判断该用户是否点赞其他的文章", notes = "用来判断该用户是否点赞其他的文章，传来文章的id,返回true代表点赞，false代表未点赞", response = boolean.class)
    @PostMapping("/judgeBlogOfTransmit")
    @ResponseBody
    public boolean judgeBlogOfTransmit(@ApiParam(value = "文章的id值", required = true) @RequestParam("id") Integer id,
                                       @ApiParam(value = "用于存放登录的用户的id") HttpSession session) {
        return blogService.judgeBlogOfTransmit((Integer) session.getAttribute("id"), id);
    }

    @ApiOperation(value = "该接口用来判断该用户是否点赞其他的评论", notes = "用来判断该用户是否点赞其他的评论，传来评论的id,返回true代表点赞，false代表未点赞", response = boolean.class)
    @PostMapping("/judgeCommentOfLike")
    @ResponseBody
    public boolean judgeCommentOfLike(@ApiParam(value = "评论的id值", required = true) @RequestParam("id") Integer id,
                                      @ApiParam(value = "用于存放登录的用户的id") HttpSession session) {
        return blogService.judgeCommentOfLike((Integer) session.getAttribute("id"), id);
    }

    @GetMapping("/getTheLatestHotBlog")
    @ApiOperation(value = "获取近些天的热搜文章", notes = "根据点赞量和转发量判断热搜，list属性中存放的是热搜数据，每一条为一个对象", response = AuditBlog.class)
    public ModelAndView getTheLatestHotBlog() {
        ModelAndView mav = new ModelAndView("hot-list");
        List<String> hotLabelList = blogService.getTenHotSearchBlog();
        mav.addObject("hotLabelList", hotLabelList);
        List<AuditBlog> list = blogService.getTheLatestHotBlog(1, 10);
        mav.addObject("allType", blogService.getTypeByLike(null));
        mav.addObject("list", list);
        return mav;
    }

    @GetMapping("/getLoadedTheLatestHotBlog")
    @ApiOperation(value = "ajax获取近些天的热搜文章，用于热门榜单", notes = "根据点赞量和转发量判断热搜，每一条为一个对象", response = AuditBlog.class)
    @ResponseBody
    public List<AuditBlog> getLoadedTheLatestHotBlog(@ApiParam(name = "pageNo", value = "当前的页码数") @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                     @ApiParam(name = "pageSize", value = "每页的数量") @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        return blogService.getTheLatestHotBlog(pageNo, pageSize);
    }


    @GetMapping("/getTheLatestHotBlogForUnLogin")
    @ApiOperation(value = "获取近些天的热搜文章给未登录的用户", notes = "根据点赞量和转发量判断热搜,list属性中存放的是热搜数据，每一条为一个对象", response = AuditBlog.class)
    public ModelAndView getTheLatestHotBlogForUnLogin() {
        ModelAndView mav = new ModelAndView("unlogin-list");
        List<AuditBlog> list = blogService.getTheLatestHotBlog(1, 20);
        List<String> hotLabelList = blogService.getTenHotSearchBlog();
        mav.addObject("hotLabelList", hotLabelList);
        mav.addObject("list", list);
        return mav;
    }


    @GetMapping("/getHotBlogForUnLogin")
    @ApiOperation(value = "获取热搜文章前50条给未登录的用户", notes = "根据点赞量和转发量判断热搜")
    @ApiResponses(@ApiResponse(code = 200, message = "查询成功，list属性中存放的是热搜数据，每一条为一个字符串", response = String.class))
    public ModelAndView getHotBlogForUnLogin() {
        ModelAndView mav = new ModelAndView("unlogin-search");
        List<String> list = blogService.getHotBlog();
        List<String> hotSearchBlog = blogService.getTenHotSearchBlog();
        mav.addObject("fiftyHotLabel", list);
        mav.addObject("hotLabelList", hotSearchBlog);
        return mav;
    }

    @GetMapping("/getTheLatestHotBlogForLogin")
    @ApiOperation(value = "获取近些天的热搜文章给用户的文章较少的人", notes = "根据点赞量和转发量判断热搜")
    @ApiResponses(@ApiResponse(code = 200, message = "查询成功，list属性中存放的是热搜数据，每一条为一个对象", response = AuditBlog.class))
    @ResponseBody
    public List<AuditBlog> getTheLatestHotBlogForLogin() {
        return blogService.getTheLatestHotBlogForLogin();
    }

    @GetMapping("/searchBlog")
    @ApiOperation(value = "搜索文章或用户", notes = "用户搜索文章或用户，1.文章是文章内容和标签2.用户是用户名")
    @ApiResponses(@ApiResponse(code = 200, message = "查询成功，list属性中放有俩个集合，1.一个是blogList里面放的是Blog对象2.一个是userList，里面放的是User对象", response = List.class))
    @ResponseBody
    public List<Object> searchBlog(@ApiParam(name = "condition", value = "查询的条件", required = true) @RequestParam(name = "condition") String condition) {
        List<String> blogList = blogService.getSearchBlogByLike(condition);
        List<User> userList = userService.getUserByLike(condition);
        List<Object> list = new ArrayList<>();
        list.add(blogList);
        list.add(userList);
        return list;
    }


    @GetMapping("/skipToBlog")
    @ApiOperation(value = "点击文章时跳转到 综合的页面", notes = "点击文章时跳转到与文章相关的文章")
    @ApiResponses(@ApiResponse(code = 200, message = "查询成功，1.list:与该文章相关的文章，放的是AuditBlog对象；2.hotSearchBlog：右边的热搜（10条），放的是Blog对象；"))
    public ModelAndView skipToBlog(@ApiParam(value = "文章的标签label", required = true) @RequestParam("label") String label, HttpSession session) {
        ModelAndView mav = new ModelAndView("search");
        List<AuditBlog> list = blogService.getSearchAuditBlogByLike(label, 1, 10);
        List<String> hotSearchBlog = blogService.getTenHotSearchBlog();
        mav.addObject("allType", blogService.getTypeByLike(null));
        mav.addObject("list", list);
        session.setAttribute("label", label);
        mav.addObject("label", label);
        mav.addObject("hotLabelList", hotSearchBlog);
        return mav;
    }

    @GetMapping("/skipToLoadedBlog")
    @ApiOperation(value = "ajax获取点击文章时，跳转到综合的界面", notes = "点击文章时跳转到与文章相关的文章", response = AuditBlog.class)
    @ResponseBody
    public List<AuditBlog> skipToLoadedBlog(@ApiParam(value = "文章的标签label", required = true) @RequestParam("label") String label,
                                            @ApiParam(name = "pageNo", value = "当前的页码数") @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                            @ApiParam(name = "pageSize", value = "每页的数量") @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        return blogService.getSearchAuditBlogByLike(label, pageNo, pageSize);
    }


    @GetMapping("/skipToAllUser")
    @ApiOperation(value = "点击用户时跳转到 用户的页面", notes = "点击用户跳到用户相关的页面")
    @ApiResponses(@ApiResponse(code = 200, message = "查询成功，1.list:相关的用户，放的是User对象；2.hotSearchBlog：右边的热搜（10条），放的是Blog对象；"))
    public ModelAndView skipToAllUser(HttpSession session) {
        ModelAndView mav = new ModelAndView("search-user");
        Object label = session.getAttribute("label");
        System.out.println(label);
        List<User> list = userService.getUserByLike((String) session.getAttribute("label"));
        List<String> hotSearchBlog = blogService.getTenHotSearchBlog();
        mav.addObject("label", session.getAttribute("label"));
        mav.addObject("allType", blogService.getTypeByLike(null));
        mav.addObject("list", list);
        mav.addObject("hotLabelList", hotSearchBlog);
        return mav;
    }


    @PostMapping("/deleteTheBlog")
    @ApiOperation(value = "用户删除自己的文章")
    @ResponseBody
    public Result deleteTheBlog(@ApiParam(value = "文章id") @RequestParam("id") Integer id) {
        return blogService.deleteTheBlog(id);
    }


    @PostMapping("/likeComment")
    @ApiOperation(value = "用户点赞评论", notes = "用户点赞一级评论或二级评论")
    @ResponseBody
    public Result likeComment(@ApiParam(value = "评论的id值") @RequestParam("id") Integer id,
                              HttpSession session) {

        return blogService.likeComment((Integer) session.getAttribute("id"), id);
    }

    @PostMapping("/notLikeComment")
    @ApiOperation(value = "用户取消点赞评论", notes = "用户取消点赞一级评论或二级评论")
    @ResponseBody
    public String notLikeComment(@ApiParam(value = "评论的id值") @RequestParam("id") Integer id,
                                 HttpSession session) {
        return blogService.notLikeComment((Integer) session.getAttribute("id"), id) == 1 ? "点赞成功" : "点赞失败";
    }

    @PostMapping("/reportBlog")
    @ApiOperation(value = "用户举报文章", notes = "用户举报其他用户的文章", response = boolean.class)
    @ResponseBody
    public Result reportBlog(@ApiParam(value = "文章的id", required = true) @RequestParam("bid") Integer bid,
                             @ApiParam(value = "举报的原因", required = true) @RequestParam("msg") String msg,
                             HttpSession session) {
        return blogService.reportBlog((Integer) session.getAttribute("id"), bid, msg);
    }

    @GetMapping("/skipInEnvelope")
    @ApiOperation(value = "用于信封中的点击文章跳转", notes = "用于信封中的点击文章跳转，评论和赞的跳转", response = AuditBlog.class)
    public ModelAndView skipInEnvelope(@ApiParam(value = "文章的id", required = true) @RequestParam("id") Integer id) {
        ModelAndView mav = new ModelAndView("message-comment");
        mav.addObject("auditBlog", blogService.getAuditBlogById(id));
        mav.addObject("color", "black");
        mav.addObject("hotLabelList", blogService.getTenHotSearchBlog());
        return mav;
    }


}